/*
 * Copyright 2010 Joshua Smith and Nelson Llewellyn
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package norse.model;

/**
 * Network port.
 */
public class NorsePort {

        private int portId;
        private String portProtocol;
        private String service;
        private boolean open;

        @Override
        public String toString() {
            StringBuilder bld = new StringBuilder();
            bld.append("Port ");
            bld.append(portId);
            bld.append("/(");
            bld.append(service);
            bld.append(" over ");
            bld.append(portProtocol);
            bld.append("):");
            if (open) {
                bld.append("open");
            } else {
                bld.append("closed");
            }
            return bld.toString();
        }

    /**
     * Accessor.
     *
     * @return the portId
     */
    public int getPortId() {
        return portId;
    }

    /**
     * Mutator.
     *
     * @param portId the portId to set
     */
    public void setPortId(int portId) {
        this.portId = portId;
    }

    /**
     * Accessor.
     *
     * @return the portProtocol
     */
    public String getPortProtocol() {
        return portProtocol;
    }

    /**
     * Mutator.
     *
     * @param portProtocol the portProtocol to set
     */
    public void setPortProtocol(String portProtocol) {
        this.portProtocol = portProtocol;
    }

    /**
     * Accessor.
     *
     * @return the service
     */
    public String getService() {
        return service;
    }

    /**
     * Mutator.
     *
     * @param service the service to set
     */
    public void setService(String service) {
        this.service = service;
    }

    /**
     * Accessor.
     *
     * @return the open
     */
    public boolean isOpen() {
        return open;
    }

    /**
     * Mutator.
     * 
     * @param open the open to set
     */
    public void setOpen(boolean open) {
        this.open = open;
    }

}
